*****************************************
*** ONLINE APPENDIX: SOCIAL DIVISIONS ***
*****************************************

*NOTE: This do-file should be executed on the 2015 BES dataset available for free at https://www.britishelectionstudy.com/
*NOTE: To reproduce the results, please use Stata 15 with the following packages installed:
ssc install blidschemes
*NOTE: If package is already installed, run the do-file from here

*Coding class image variable
recode b13_5 (1 2=1) (3 4=-1) (else=.), gen(lab_wc)
tab lab_wc

*Coding vote (Labour vs. Conservatives)
recode b02 (1=1) (2=0) (else=.), gen(votelab)
tab votelab

*Coding voter class position
recode ns_sec (10 34 81 91=1) (20 31 32 50 =2) (34 41 42 43 44 60 71 72 73 121 126 131=3) ///
	(74 100 111 112 122 123 124 125 132 133 134 135=4) (else=.), gen(class4)
recode class4 (.=1) if y17==2| y17==4
recode class4 (4=3) if y22==1
tab class4

*** Figure A2 ***
*Marginal class effect over perceptions of Labour's class image 
logit votelab i.class4##c.lab_wc
margins, dydx(i(4).class4) at(lab_wc=(-1 1))
marginsplot, scheme(plotplainblind) ylabel(-.30 (.05) .35) xlabel(-1(1)1) xtitle("Labour looking after the working class") ///
	 title("") ytitle("Marginal class effect") recast(line) recastci(rarea) ciopts(color(gs14)) name(class4, replace)  

*END OF DO-FILE
